using System;
using System.Web;
using Castle.Windsor;
using Castle.Windsor.Configuration.Interpreters;

namespace MonorailTest
{
    public class Global : HttpApplication, IContainerAccessor
    {
        private static IWindsorContainer container;

        protected void Application_Start(object sender, EventArgs e)
        {
            //ActiveRecordStarter.Initialize(Assembly.Load("MonorailTest.Model"),
            //                               ActiveRecordSectionHandler.Instance);

            container = new WindsorContainer(new XmlInterpreter());
        }

        protected void Application_End(object sender, EventArgs e)
        {
            container.Dispose();
        }

        public IWindsorContainer Container
        {
            get { return container; }
        }
        
        public static IWindsorContainer WindsorContainer
        {
            get { return container; }
        }
    }
}